<template>
  <el-container
      class="layout-container-demo"
      style="height: 500px; border: 1px solid #eee"
  >
    <el-aside width="200px" style="background-color: rgb(238, 241, 246)">
      <el-scrollbar>
        <el-menu :default-openeds="['2']">
          <el-sub-menu index="1">
            <template #title>
              <el-icon>
                <message/>
              </el-icon>
              通知
            </template>
            <el-menu-item index="1-1" @click="show='checkMessage'">审核通知</el-menu-item>
            <el-menu-item index="1-2" @click="show='resultMessage'">结果通知</el-menu-item>
          </el-sub-menu>
          <el-sub-menu index="2">
            <template #title>
              <el-icon>
                <icon-menu/>
              </el-icon>
              应用
            </template>
            <el-menu-item-group title="项目">

              <el-menu-item index="2-1" @click="show='uncheckedProject' ;  setStatus(null)">未审核的项目</el-menu-item>
              <el-menu-item index="2-2" @click="show='checkedProject' ;  setStatus('0')">已审核的项目</el-menu-item>
              <el-menu-item index="2-3" @click="show='deliveredProject';  setStatus('1')">已交付的项目</el-menu-item>
            </el-menu-item-group>
<!--            <el-menu-item-group title="任务">-->
<!--              <el-menu-item index="2-4" @click="show='TaskNeedToBeDown'">未完成的任务</el-menu-item>-->
<!--              <el-menu-item index="2-5" @click="show='TaskCompleted'">已完成的任务</el-menu-item>-->
<!--            </el-menu-item-group>-->
          </el-sub-menu>

          <el-sub-menu index="3">
            <template #title>
              <el-icon>
                <setting/>
              </el-icon>
              设置
            </template>
            <el-menu-item-group>
              <el-menu-item index="3-1" @click="show = 'home'">个人信息</el-menu-item>
              <el-menu-item index="3-2" @click="show = 'update'">修改信息</el-menu-item>
            </el-menu-item-group>


          </el-sub-menu>
        </el-menu>
      </el-scrollbar>
    </el-aside>

    <el-container>
      <el-header style="text-align: right; font-size: 12px">
        <div class="toolbar">
          <el-dropdown>
            <el-icon style="margin-right: 8px; margin-top: 1px"
            >
              <setting
              />
            </el-icon>
            <template #dropdown>
              <el-dropdown-menu>
                <el-dropdown-item @click="show='home'">View</el-dropdown-item>
                <el-dropdown-item @click="show='update'">Update</el-dropdown-item>
                <el-dropdown-item @click="$router.push('/user/logout')">Logout</el-dropdown-item>
              </el-dropdown-menu>
            </template>
          </el-dropdown>
          <span>{{ userInfo.username }}</span>
        </div>
      </el-header>

      <el-main>
        <user-home v-if="show=='home'|| show==null"></user-home>
        <user-update v-if="show=='update'"></user-update>
        <project-list-to-admin v-if="show=='uncheckedProject' "></project-list-to-admin>
        <project-list-to-admin v-if="show=='checkedProject' "></project-list-to-admin>
        <project-list-to-admin v-if="show=='deliveredProject' "></project-list-to-admin>

      </el-main>
    </el-container>
  </el-container>
</template>

<script lang="ts" setup>
import {Message, Menu as IconMenu, Setting} from '@element-plus/icons-vue'
import UserUpdate from "@/components/user/UserUpdate.vue";
import {ref} from "vue";
import {UserStoreModule} from "@/store/modules/User";
import UserHome from "@/components/user/UserHome.vue";
import ProjectListToAdmin from "@/components/project/List/ProjectListToAdmin.vue";

let show = ref<string>();
const userInfo = UserStoreModule.userInfoFromSessionStorage;
const setStatus = (status: string)=>{
  sessionStorage.setItem("project.status", status)
}



</script>

<style scoped>
.layout-container-demo .el-header {
  position: relative;
  background-color: #b3c0d1;
  color: var(--el-text-color-primary);
}

.layout-container-demo .el-aside {
  width: 240px;
  color: var(--el-text-color-primary);
  background: #fff !important;
  border-right: solid 1px #e6e6e6;
  box-sizing: border-box;
}

.layout-container-demo .el-menu {
  border-right: none;
}

.layout-container-demo .el-main {
  padding: 0;
}

.layout-container-demo .toolbar {
  position: absolute;
  display: inline-flex;
  align-items: center;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
}
</style>